<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
	<meta charset="utf-8" />
	<title>固定资产管理系统</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<meta name="MobileOptimized" content="320">
	<!-- BEGIN GLOBAL MANDATORY STYLES -->
	<link href="${ctx}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<!-- END GLOBAL MANDATORY STYLES -->	
	<!-- BEGIN THEME STYLES --> 
	<link href="${ctx}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/pages/tasks.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/themes/light.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/css/custom.css" rel="stylesheet" type="text/css"/>

	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/select2/select2_metro.css" />
	<link rel="stylesheet" href="${ctx}/assets/plugins/data-tables/DT_bootstrap.css" />
	
	<link href="${ctx}/assets/plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
	<!-- END THEME STYLES -->
	<link rel="shortcut icon" href="favicon.ico" />
	<style type="text/css">
		.page-content{
			min-height:900px;
		}
	</style>
</head>
<body class="page-header-fixed">
	<!-- BEGIN HEADER -->
	<%@include file="../include/header.jsp" %>
	<!-- END HEADER -->
	<div class="clearfix"></div>
	<!-- BEGIN CONTAINER -->
	<div class="page-container">
		<!-- BEGIN SIDEBAR -->
		<%@include file="../include/sidebar.jsp" %>
		<!-- END SIDEBAR -->
		<!-- BEGIN PAGE -->
		<div class="page-content">			
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
						资产盘点流程
					</h3>
					
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN TAB PORTLET-->   
					<div class="portlet box green tabbable">
						<div class="portlet-title">
							<div class="caption"><i class="fa fa-reorder"></i>盘点流程待办</div>
						</div>
						<div class="portlet-body">
							<div class=" portlet-tabs">
								<ul class="nav nav-tabs">
									<shiro:hasRole name="固资管理员"><c:if test="${!empty peiChangRZ}"><li <c:if test="${active==5}">class="active"</c:if>><a href="#portlet_tab4" data-toggle="tab">赔偿确认</a></li></c:if></shiro:hasRole>
									<shiro:hasRole name="财务"><c:if test="${!empty shouJiaoCZ}"><li <c:if test="${active==4}">class="active"</c:if>><a href="#portlet_tab3" data-toggle="tab">赔偿入账</a></li></c:if></shiro:hasRole>
									<c:if test="${!empty peiChangTX}"><li <c:if test="${active==3}">class="active"</c:if>><a href="#portlet_tab2" data-toggle="tab">上缴残值</a></li></c:if>
									<shiro:hasRole name="固资管理员"><c:if test="${!empty suoPeiList}"><li <c:if test="${active==2}">class="active"</c:if>><a href="#portlet_tab1" data-toggle="tab">索赔</a></li></c:if></shiro:hasRole>
									<c:if test="${!empty panDianList}"><li <c:if test="${active==1}">class="active"</c:if>><a href="#portlet_tab0" data-toggle="tab">资产盘点</a></li></c:if>
								</ul>
								<div class="tab-content">
									<div class="tab-pane <c:if test="${active==1}">active</c:if>" id="portlet_tab0">
										<div class="portlet-body">
											<div class="table-scrollable">
												<table class="table table-striped table-bordered table-hover" id="sample_1">
													<thead>
														<tr>
															<th>盘点日期</th>														
															<th>资产编号</th>
															<th>物资名称</th>
															<th>品牌</th>
															<th>规格型号</th>
															<th>产品序列号</th>
															<th>查看</th>																					
															<th>操作</th>
														</tr>
													</thead>
													<tbody>
														<c:forEach items="${panDianList }" var="u">													
														<tr>
															<td><fmt:formatDate value="${u.panDianRQ }" pattern="yyyy-MM-dd"/></td>
															<td>${u.ziChanBH }</td>
															<td>${u.wuZiMC }</td>
															<td>${u.pinPai }</td>
															<td>${u.guiGeXH }</td>
															<td>${u.chanPinXLH }</td>
															<td>
																<a href="${ctx }/wuzi/wuZiDetail.do?id=${u.id}" target="_blank" class="btn default btn-xs green-stripe">物资详情</a>
															</td>
															<td>
																<a href="javascript:panDianQueRen('${u.id }')" class="btn default btn-xs green-stripe">盘点确认</a>&nbsp;&nbsp;
																<a href="${ctx }/wuzi/buBanYiJiaoSQ.do?id=${u.id}" target="_blank" class="btn default btn-xs green-stripe">补办移交</a>&nbsp;&nbsp;
																<a href="javascript:panDianDiuShi('${u.id }')" class="btn default btn-xs green-stripe">丢失</a>&nbsp;&nbsp;
																<a class="btn default btn-xs yellow-stripe" href="${ctx }/wuzi/panDianBaoFei.do?id=${u.id}" target="_blank">申请报废</a>
															</td>
														</tr>
														</c:forEach>													
													</tbody>
												</table>
											</div>
										</div>
									</div>
									<div class="tab-pane <c:if test="${active==2}">active</c:if>" id="portlet_tab1">
										<div class="portlet-body">
											<div class="table-scrollable">
												<table class="table table-striped table-bordered table-hover" id="sample_1">
													<thead>
														<tr>																										
															<th>资产编号</th>
															<th>物资名称</th>
															<th>品牌</th>
															<th>规格型号</th>
															<th>产品序列号</th>
															<th>查看</th>																					
															<th>操作</th>
														</tr>
													</thead>
													<tbody id="sp">
														<c:forEach items="${suoPeiList }" var="u">													
														<tr>														
															<td>${u.wuZi.ziChanBH }</td>
															<td>${u.wuZi.wuZiMC }</td>
															<td>${u.wuZi.pinPai }</td>
															<td>${u.wuZi.guiGeXH }</td>
															<td>${u.wuZi.chanPinXLH }</td>
															<td>
																<a href="${ctx }/wuzi/wuZiDetail.do?id=${u.wuZi.id}" target="_blank" class="btn default btn-xs green-stripe">物资详情</a>
															</td>
															<td>
																<a href="${ctx }/wuzi/suoPei.do?id=${u.id}" target="_blank" class="btn default btn-xs green-stripe">索赔</a>
															</td>
														</tr>
														</c:forEach>													
													</tbody>
												</table>
											</div>
										</div>
									</div>
									<div class="tab-pane <c:if test="${active==3}">active</c:if>" id="portlet_tab2">
										<div class="portlet-body">
											<div class="table-scrollable">
												<table class="table table-striped table-bordered table-hover" id="sample_1">
													<thead>
														<tr>																										
															<th>资产编号</th>
															<th>物资名称</th>
															<th>品牌</th>
															<th>规格型号</th>
															<th>产品序列号</th>
															<th>赔偿金额</th>
															<th>查看</th>																					
															<th>操作</th>
														</tr>
													</thead>
													<tbody id="spqr">
														<c:forEach items="${peiChangTX }" var="u">													
														<tr>														
															<td>${u.wuZi.ziChanBH }</td>
															<td>${u.wuZi.wuZiMC }</td>
															<td>${u.wuZi.pinPai }</td>
															<td>${u.wuZi.guiGeXH }</td>
															<td>${u.wuZi.chanPinXLH }</td>
															<td>${u.peiChangJE }</td>
															<td>
																<a href="${ctx }/wuzi/wuZiDetail.do?id=${u.wuZi.id}" target="_blank" class="btn default btn-xs green-stripe">物资详情</a>
															</td>
															<td>
																<a href="javascript:shangJiaoCZ('${u.id }')" class="btn default btn-xs green-stripe">上缴</a>
															</td>
														</tr>
														</c:forEach>													
													</tbody>
												</table>
											</div>
										</div>
									</div>
									<div class="tab-pane <c:if test="${active==4}">active</c:if>" id="portlet_tab3">
										<div class="portlet-body">
											<div class="table-scrollable">
												<table class="table table-striped table-bordered table-hover" id="sample_1">
													<thead>
														<tr>																										
															<th>资产编号</th>
															<th>物资名称</th>
															<th>品牌</th>
															<th>规格型号</th>
															<th>产品序列号</th>
															<th>赔偿金额</th>
															<th>查看</th>																					
															<th>操作</th>
														</tr>
													</thead>
													<tbody id="sjcz">
														<c:forEach items="${shouJiaoCZ }" var="u">													
														<tr>														
															<td>${u.wuZi.ziChanBH }</td>
															<td>${u.wuZi.wuZiMC }</td>
															<td>${u.wuZi.pinPai }</td>
															<td>${u.wuZi.guiGeXH }</td>
															<td>${u.wuZi.chanPinXLH }</td>
															<td>${u.peiChangJE }</td>
															<td>
																<a href="${ctx }/wuzi/wuZiDetail.do?id=${u.wuZi.id}" target="_blank" class="btn default btn-xs green-stripe">物资详情</a>
															</td>
															<td>
																<a href="javascript:peiChangRZ('${u.id }')" class="btn default btn-xs green-stripe">收缴残值</a>
															</td>
														</tr>
														</c:forEach>													
													</tbody>
												</table>
											</div>
										</div>
									</div>
									<div class="tab-pane <c:if test="${active==5}">active</c:if>" id="portlet_tab4">
										<div class="portlet-body">
											<div class="table-scrollable">
												<table class="table table-striped table-bordered table-hover" id="sample_1">
													<thead>
														<tr>																										
															<th>资产编号</th>
															<th>物资名称</th>
															<th>品牌</th>
															<th>规格型号</th>
															<th>产品序列号</th>
															<th>赔偿金额</th>
															<th>查看</th>																					
															<th>操作</th>
														</tr>
													</thead>
													<tbody id="pcqr">
														<c:forEach items="${peiChangRZ }" var="u">													
														<tr>														
															<td>${u.wuZi.ziChanBH }</td>
															<td>${u.wuZi.wuZiMC }</td>
															<td>${u.wuZi.pinPai }</td>
															<td>${u.wuZi.guiGeXH }</td>
															<td>${u.wuZi.chanPinXLH }</td>
															<td>${u.peiChangJE }</td>
															<td>
																<a href="${ctx }/wuzi/wuZiDetail.do?id=${u.wuZi.id}" target="_blank" class="btn default btn-xs green-stripe">物资详情</a>
															</td>
															<td>
																<a href="javascript:peiChangQR('${u.id }')" class="btn default btn-xs green-stripe">确认</a>
															</td>
														</tr>
														</c:forEach>													
													</tbody>
												</table>
											</div>
										</div>
									</div>
								</div>								
							</div>
						</div>
					</div>					
				</div>
			</div>
			
			<!-- END PAGE CONTAINER-->			
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<c:if test="${!empty peiChangTX}">
	<div id="div1" style="display:none">  
	  <table width="100%" border="0">	  
	  <tr>
	    <td colspan="4" align="center"><strong>物资赔偿单</strong></td>
	  </tr>
	  <tr>
	    <td width="25%" align="left"></td>
	    <td colspan="2" align="center" id="danJuRQ"></td>
	    <td width="25%" align="center">字第&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</td>
	  </tr>
	</table>
	</div>
	<div id="div2" style="display:none">
	<table width="100%" border="1" align="center" cellspacing="1" >
	  <tr>
	    <th width="25%">物资编号</th>
	    <td width="25%" id="bFziChanBH"></td>
	    <th width="25%">资产编码</th>
	    <td width="25%" id="bFziChanBM"></td>	    
	  </tr>
	  <tr>
	    <th width="25%">物资名称</th>
	    <td width="25%" id="bFwuZiMC"></td>
	    <th width="25%">购买日期</th>
	    <td width="25%" id="bFgouMaiRQ"></td>
	  </tr>
	  <tr>
	    <th width="25%">开始计提日期</th>
	    <td width="25%" id="bFkaiShiJiTiRQ"></td>
	    <th width="25%">物资原值</th>
	    <td width="25%" id="bFwuZiYZ"></td>
	  </tr>
	  <tr>
	    <%--<th width="25%">物资净值</th>
	    <td width="25%" id="bFwuZiJingZhi"></td>--%>
	    <th width="25%">累计折旧金额</th>
	    <td width="25%" id="bFleiJiZheJiuJE"></td>
	  </tr>
	  <%--<tr>
	  	<th width="25%">折旧月限</th>
	    <td width="25%" id="bFzheJiuYX"></td>
	    <th width="25%">已折旧月数</th>
	    <td width="25%" id="bFyiZheJiuYS"></td>
	    
	  </tr>--%>
	  <tr>
	    <th width="25%">使用部门</th>
	    <td width="25%" id="bFshiYongBM"></td>
	    <th width="25%">使用人</th>
	    <td width="25%" id="bFshiYongR"></td>
	  </tr>
	  <tr>
	    <th>赔偿金额</th>
	    <td colspan="3" id="peiChangJE"></td>	    
	  </tr>
	  <tr>
	    <th width="25%" rowspan="2">使用人签字</th>
	    <td width="25%" rowspan="2"><br><br><br></td>
	    <th width="25%" rowspan="2">财务签字</th>
	    <td width="25%" rowspan="2"><br><br><br></td>
	  </tr>
	</table>
	</div>	
	<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> 
		<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop32.exe"></embed>
	</object>
	</c:if>
	<%@include file="../include/footer.jsp" %>
	<!-- END FOOTER -->
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->   
	<!--[if lt IE 9]>
	<script src="${ctx}/assets/plugins/respond.min.js"></script>
	<script src="${ctx}/assets/plugins/excanvas.min.js"></script> 
	<![endif]-->   
	<script src="${ctx}/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>   
	<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
	<script src="${ctx}/assets/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
	<script src="${ctx}/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	<!-- END CORE PLUGINS -->
	
	<!-- IMPORTANT! fullcalendar depends on jquery-ui-1.10.3.custom.min.js for drag & drop support -->
	<script src="${ctx}/assets/plugins/fullcalendar/fullcalendar/fullcalendar.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery-easy-pie-chart/jquery.easy-pie-chart.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery.sparkline.min.js" type="text/javascript"></script>  
	<!-- END PAGE LEVEL PLUGINS -->
	<!-- BEGIN PAGE LEVEL SCRIPTS -->
	<script src="${ctx}/assets/scripts/app.js" type="text/javascript"></script>
	<script src="${ctx}/assets/scripts/index.js" type="text/javascript"></script>
	<script src="${ctx}/assets/scripts/tasks.js" type="text/javascript"></script>

	<script type="text/javascript" src="${ctx}/assets/plugins/select2/select2.min.js"></script>
	<script src="${ctx}/assets/plugins/bootstrap-modal/js/bootstrap-modalmanager.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/bootstrap-modal/js/bootstrap-modal.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/scripts/table-advanced.js?t=202004022058"></script>
	<script type="text/javascript" src="${ctx }/lodop/LodopFuncs.js"></script>    
	<!-- END PAGE LEVEL SCRIPTS -->
	<script>
		jQuery(document).ready(function() {    
		   App.init(); // initlayout and core plugins
		   $('#A').addClass("active");
		   $('#A6').addClass('active');
		   TableAdvanced.init();		   
		});
		
		var panDianQueRen=function(id){
			$.ajax({
				type:"GET",
				url:"${ctx}/wuzi/panDianQueRen.do?id="+id,
				dataType:"json",
				async:false,
				success:function(data){
					if(data.result=="success"){
						alert('您选择了盘点确认！');
						window.location.reload();
					}
				}
			});
		}
		
		var panDianDiuShi=function(id){
			if(window.confirm('您确认丢失吗？')){
				$.ajax({
					type:"GET",
					url:"${ctx}/wuzi/panDianDiuShi.do?id="+id,
					dataType:"json",
					async:false,
					success:function(data){
						if(data.result=="success"){
							alert('固资管理员将计算赔偿金额！');
							window.location.reload();
						}else if(data.result=="conflict"){
							alert("有其他流程正在进行中，不能提交");
							window.close();
						}
					}
				});
			}else{
				
			}
		}		
		
		var shangJiaoCZ=function(id){
			$.ajax({
				type:"POST",
				data:{
					"id":id
				},
				url:"${ctx}/wuzi/shangJiaoCZ.do",
				dataType:"json",
				async:false,
				success:function(data){
					if(data.result=="success"){
						daYinDanJu(id);
						alert("请将单据送到财务部门！");
						$.ajax({
							type:"POST",
							url:"${ctx}/wuzi/spqrList.do",
							dataType:"html",
							success:function(data){
								$('#spqr').html(data);
							}
						});						
					}else{
						alert("确认未成功");
					}
					
				}
			});
		}
		
		<c:if test="${!empty peiChangTX}">
		var LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
		var iRadioValue=1;
		function PreviewMytable(){
			LODOP=getLodop();  
			LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_预览打印表格");
			LODOP. SET_PRINT_PAGESIZE (2, 0, 0,"A4");
			LODOP.ADD_PRINT_TABLE("10mm","30mm","190mm","50mm",document.getElementById("div1").innerHTML);
	    	LODOP.ADD_PRINT_TABLE("25mm","30mm","190mm","100mm",document.getElementById("div2").innerHTML);
			LODOP.SET_PRINT_STYLEA(0,"TableHeightScope",iRadioValue);
			LODOP.PREVIEW();
		};
		function check(thisValue){
		  iRadioValue=thisValue;
		}
		
		var daYinDanJu=function(id){			
			$.ajax({
				type:"POST",
				data:{
					"id":id
				},
				url:"${ctx}/wuzi/peiChangDanJu.do",
				dataType:"json",
				async:false,
				success:function(data){
					$('#danJuRQ').html(data.danJuRQ);
					$('#bFziChanBH').html(data.bFziChanBH);
					$('#bFziChanBM').html(data.bFziChanBM);
					$('#bFwuZiMC').html(data.bFwuZiMC);
					$('#bFgouMaiRQ').html(data.bFgouMaiRQ);
					$('#bFkaiShiJiTiRQ').html(data.bFkaiShiJiTiRQ);
					$('#bFwuZiYZ').html(data.bFwuZiYZ);
					$('#bFwuZiJingZhi').html(data.bFwuZiJingZhi);
					$('#bFleiJiZheJiuJE').html(data.bFleiJiZheJiuJE);
					$('#bFzheJiuYX').html(data.bFzheJiuYX);
					$('#bFyiZheJiuYS').html(data.bFyiZheJiuYS);					
					$('#bFshiYongBM').html(data.bFshiYongBM);
					$('#bFshiYongR').html(data.bFshiYongR);
					$('#peiChangJE').html(data.peiChangJE);
					PreviewMytable();
				}
			});
		}
		</c:if>
		
		var peiChangRZ=function(id){
			$.ajax({
				type:"POST",
				data:{
					"id":id
				},
				url:"${ctx}/wuzi/peiChangRZ.do",
				dataType:"json",
				async:false,
				success:function(data){
					if(data.result=="success"){
						alert("请将赔偿金额入账");
						$.ajax({
							type:"POST",
							url:"${ctx}/wuzi/sjczList.do",
							dataType:"html",
							success:function(data){
								$('#sjcz').html(data);
							}
						});
					}else{
						alert("确认未成功");
					}
				}
			});
		}
		
		var peiChangQR=function(id){
			$.ajax({
				type:"POST",
				data:{
					"id":id
				},
				url:"${ctx}/wuzi/peiChangQR.do",
				dataType:"json",
				async:false,
				success:function(data){
					if(data.result=="success"){
						alert("赔偿金额已入账!");
						
						$.ajax({
							type:"POST",
							url:"${ctx}/wuzi/pcqrList.do",
							dataType:"html",
							success:function(data){
								$('#pcqr').html(data);
							}
						});
					}else{
						alert("确认未成功");
					}
				}
			});
		}		
	</script>
	<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>